// type Extract<T, U> = T extends U ? T : never // s99
// 这里是帮助理解，临时把never修改成boolean,实际开发还是使用上面的s99
type Extract<T, U> = T extends U ? T : boolean // s100

type unionExtractType = Extract<string, number | string> // string
type unionExtractType2 = Extract<string | number, number | string> // string | number
type unionExtractType3 = Extract<string | number, number | string | symbol> // string | number
/**
 * 分解判断
 * 第一次 string extends string ? T : boolean // string
 * 第二次 number extends string ? T : boolean // boolean
 */
type unionExtractType4 = Extract<string | number, string> // string | boolean
type unionExtractType5 = Extract<string | number | symbol, string | number> // string | number | boolean


function testTypeAssesrtForUnionType(one: string |number, two: string) {
    one as string
    one as number
    one as any
    one as string | number
    two as string | number
}

export {}
